package main

import (
	"context"
	"fmt"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
	"grpcNacos/proto"
	"log"
)

func main() {
	//创建serverConfig
	//支持多个;至少一个ServerConfig

	//target := fmt.Sprintf("%s:%d", instance.Ip, instance.Port)
	target := "127.0.0.1:49632"
	fmt.Printf("target:%v",target)

	conn, err := grpc.Dial(target, grpc.WithTransportCredentials(insecure.NewCredentials()))
	if err != nil {
		//og.Fatalf("监听%s:%d失败:%s", instance.Ip, instance.Port, err.Error())
	}
	client := proto.NewStudentClient(conn)
	res, err := client.Learn(context.Background(), &proto.LearnReq{Id: 4})
	if err != nil {
		log.Fatalf("调用TestClient失败: %s", err.Error())
	}
	log.Println(res.GetName())
}

